<template>
	<view class="page-box">
		<view v-if="userinfo" class="info-box" @click="Jump('./userinfo')">
			<view class="info-left">
				<image :src="userinfo.avatarUrl" class="avatar"></image>
				<view class="name-box">
					<view class="name">{{userinfo.nickname}}</view>
					<view>{{userinfo.gender == 2 ? '女':'男'}}</view>
				</view>
			</view>
			<image class="jiantou" src="../../static/image/youjiantou.png"></image>
		</view>
		<view v-else class="login-btn">
			<view class="btn" @click="toLogin">去登录</view>
		</view>
		<view class="order-box">
			<view class="info-box" @click="Jump('./address-list')">
				<view class="text"><image class="icon" src="../../static/image/addr.png"></image>收货地址</view>
				<image class="jiantou" src="../../static/image/youjiantou.png"></image>
			</view>
			<view class="info-box" @click="Jump('/pages/order/order-list')">
				<view class="text"><image src="../../static/image/order.png" class="icon"></image>我的订单</view>
				<image class="jiantou" src="../../static/image/youjiantou.png"></image>
			</view>
			<view class="info-box" @click="Jump('./collect')">
				<view class="text"><image src="../../static/image/collect.png" class="icon"></image>我的收藏</view>
				<image class="jiantou" src="../../static/image/youjiantou.png"></image>
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		computed:{
			userinfo(){
				return uni.getStorageSync('userinfo')
			}
		},
		onLoad() {
			
		},
		methods: {
			Jump(e){
				uni.navigateTo({
					url:e
				})
			},
			toLogin(){
				uni.redirectTo({
					url:'../login'
				})
			}	
			
		}
	}
</script>

<style scoped lang="scss">
	.info-box{
		background-color: #FFFFFF;
		padding: 30rpx 50rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		margin-bottom: 20rpx;
	}
	.info-left{
		display: flex;
		flex-direction: row;
		align-items: center;
	}
	.avatar{
		width: 120rpx;
		height: 120rpx;
		border-radius: 50%;
	}
	.name-box{
		margin-left: 40rpx;
		display: flex;
		flex-direction:column;
		font-size: 30rpx;
		font-weight: 400;
		line-height: 50rpx;
		color: #999999;
		opacity: 1;
	}
	.name{
		font-size: 34rpx;
		font-weight: bold;
		line-height: 50rpx;
		color: #333333;
		opacity: 1;
	}
	.jiantou{
		display: inline-block;
		width: 14rpx;
		height: 24rpx;
	}
	.order-box{
		margin-top:50rpx;
		}
	.icon{
		width:40rpx;
		height:40rpx;
		margin-right: 20rpx;
	}	
	.login-btn{
		background-color: #FFFFFF;
		padding: 30rpx 40rpx;
		display: flex;
		flex-direction:row;
		justify-content: center;
	}
	.btn{
		width: 200rpx;
		padding: 20rpx 0rpx;
		text-align: center;
		border: 1rpx solid #ff6633;
		border-radius: 40rpx;
		color:#ff6633 ;
	}
</style>
